-- migrations.moon

import add_column,drop_table,create_table, types from require "lapis.db.schema"

{
  [1]: =>
    drop_table "articles"
    drop_table "users"
    drop_table "comments"
  [29]: =>
    create_table "articles", {
      { "id", types.serial }
      { "title", types.text }
      { "content", types.text }
      { "publishedAt", types.time }
      { "modifiedAt", types.time }
      { "user_id", types.foreign_key }

      "PRIMARY KEY (id)"
    }
  [30]: =>
    create_table "users", {
      { "id", types.serial }
      { "name", types.text }
      { "sex", types.text }
      { "profession", types.text }
      { "age", types.text }
      { "habits", types.text }
      { "page", types.text }
      { "study", types.text }
      { "note", types.text }

      "PRIMARY KEY (id)"
    }
  [31]: =>
    create_table "comments",{
      { "id", types.serial }
      { "title", types.text }
      { "content", types.text }
      { "user_id", types.foreign_key }
      { "article_id", types.foreign_key }
    
      "PRIMARY KEY (id)"
    }
}

